package com.caesar.exer1;

/**
 * @author caesar
 * @date 2025/7/21
 * @Description:
 * @apiNote
 */
public class CounterThread extends Thread {
    private final Counter counter;//线程数量
    private final int iterations;//每个线程递增次数

    public CounterThread(Counter counter, int iterations) {
        this.counter = counter;
        this.iterations = iterations;
    }

    @Override
    public void run() {
        for (int i = 0; i < iterations; i++) {
            counter.increment();
        }
        System.out.println(Thread.currentThread().getName() + " 完成");
    }
}

